<?php


namespace App\Models;


use Illuminate\Database\Eloquent\Model;

class OrderRemark extends Model
{
    protected $table = 'sp_order_remark_2';
    protected $primaryKey = 'id';
    public $timestamps = false;

    public static function getRemark($order_id){
        $remark = OrderRemark::where(['order_id'=>$order_id])->select('username','create_time','remark')->orderBy('id','desc')->first();
        $remark = obToArray($remark);
        if($remark){
            $remark['create_time'] = dateFormat($remark['create_time']);
        }
        return $remark;
    }
    public static function getRemarkTwo($order_id){
        $remark = OrderRemark::where(['order_id'=>$order_id])->select('username','create_time','remark')->orderBy('id','desc')->offset(1)->limit(1)->get();
        $remark = obToArray($remark);
        if($remark){
            $remark=$remark[0];
            $remark['create_time'] = dateFormat($remark['create_time']);
        }
        return $remark;
    }
}
